/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.validation.config;

import java.util.ArrayList;
import java.util.List;

import com.enfry.validation.config.Rule;

/**
 * 验证字段<br>
 * 包含字段名称、验证规则列表
 * @Title com.enfry.validation.config.Field
 * @author liulei
 * @date 2016年7月22日
 */
public class Field {
    /**
     * 验证字段的名称
     */
    private String name;
    /**
     * 验证规则列表
     */
    private List<Rule> rules;

    /**
     * 添加规则，暂不不处理去重
     *
     * @param rule 规则
     */
    public void addRule(Rule rule) {
        rules.add(rule);
    }

    public Field() {
        this.rules = new ArrayList<Rule>();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Rule> getRules() {
        return rules;
    }

    public void setRules(List<Rule> rules) {
        this.rules = rules;
    }

    @Override
    public String toString() {
        return "[ name=" + name + ", rules=" + rules + " ]";
    }
}
